#include "conn.h"
#include "event.h"
#include "dispatch.h"

struct event_base *base;

int eventInit(){
	base = event_init();
	return 0;
}

int eventAdd(int sfd, struct event &ev, int event_flag, void* arg){

	event_set(&ev, sfd, event_flag, drive_machine, (void *)arg);
	event_base_set(base, &ev);

	if (event_add(&ev, 0) == -1) {
		return -1;
	}	
	return 0;
}

int eventDel(struct event &ev){
	event_del(&ev);
}

int eventMod();

void eventLoop(){

	event_base_loop(base, 0);

}



